<?php

namespace App\Admin\Controller\Cms;

class Comment extends \App\Admin\Controller\Authed {

    public function index() {

        $count = Cms()->Comment()->countAll();

        /* 分页 */
        $pager = $this->_createPager($count);
        $length = $pager['length'];
        $start = $pager['offset'];
        $this->assign('pager', $pager);

        $rows = Cms()->Comment()->getAll($start, $length);
        
        $this->rows = $rows;
    }

    public function remove() {

        $id = intval($this->request->get('id'));

        $result = Cms()->Comment()->remove($id);

        if ($result) {
            succ();
        } else {
            fail();
        }
    }

}
